package aspirateur;

public class GenerateurDeNom {

	public static String genererNomRelatif(String _url, String source) {

		String changedLink;
		
		if (_url.startsWith(source)){
			
			if (_url.length()>source.length()){
				changedLink = _url.substring(source.length()+1);
			}else{
				changedLink = "index.html";
			}

		}else{
			
			changedLink = _url;
		}
	
		return changedLink;
	}

	public static String ajouterExtensionHtml(String href) {
		href = href.replaceAll("\\?","");
		if (!href.endsWith(".html")) {
			if (href.charAt(href.length()-1)=='/')
				href = href.substring(0,href.length()-1);
			
			String _href = href+".html";
			return _href;
			
		}else{
			
			return href;
		}
	}
}
